package com.aaa.worldmodel;

import android.os.Bundle;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.aaa.worldmodel.surface.WorldSurfaceView;
import com.aaa.worldmodel.surface.model.SkyBoxModel;

public class MainActivity extends AppCompatActivity {


    private WorldSurfaceView worldSurfaceView;
    private Handler handler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        DisplayMetrics metrics = new DisplayMetrics();
        getDisplay().getRealMetrics(metrics);
        Log.i("aaaaaaaaaa", " metrics.densityDpi " + metrics.densityDpi + "density : " + metrics.density);

        worldSurfaceView = findViewById(R.id.sv_world);
        addSkyBox();
    }

    public  void addSkyBox(){
        SkyBoxModel skyBoxModel=new SkyBoxModel();
        skyBoxModel.setScale(10);
        worldSurfaceView.addModel(skyBoxModel);
    }


    float distance=0.3f;
    public void moveUp(View view) {
        worldSurfaceView.move(0,distance,0);
    }

    public void moveLeft(View view) {
        worldSurfaceView.move(-distance,0,0);
    }

    public void moveFront(View view) {
        worldSurfaceView.move(0,0,-distance);
    }

    public void moveBack(View view) {
        worldSurfaceView.move(0,0,distance);
    }

    public void moveRight(View view) {
        worldSurfaceView.move(distance,0,0);
    }

    public void moveDown(View view) {
        worldSurfaceView.move(0,-distance,0);
    }
    public void rotateLeft(View view) {
        worldSurfaceView.rotateSelf(0,10,0);
    }
    public void rotateRight(View view) {
        worldSurfaceView.rotateSelf(0,-10,0);
    }

    public void rotateDown(View view) {
        worldSurfaceView.rotateSelf(-10,0,0);
    }

    public void rotateUp(View view) {
        worldSurfaceView.rotateSelf(10,0,0);
    }


}
